package org.wattdepot.cli.command;

import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import org.wattdepot.cli.CommandLineInterface;

/**
 * Test that checks for valid and invalid input within the ListSourceSummary class.
 * 
 * @author Anthony Xu & John Mack
 * 
 */
public class TestSummary {
 
  /**
   * Test to see if the listsummary displays correct output.
   * @throws Exception NotAuthorizedException, ResourceNotFoundException, 
   *                   BadXmlException, MiscClientException.
   */
  @Test
  public void testListSummary() throws Exception {
    CommandLineInterface cli = new CommandLineInterface();
    List<String> commands = new ArrayList<String>();
    commands.add("source");
    commands.add("SIM_KAHE_2");
    commands.add("summary");

    String theSummary = new ListSourceSummaryCommand().doCommand(cli, commands);
    assertEquals("correct output","Source: SIM_KAHE_2" + "\n" + "SubSources: None" + "\n"
        + "Description: Kahe 2 is a HECO plant on Oahu's grid that uses LSFO as its fuel." + "\n"
        + "Owner: http://server.wattdepot.org:8182/wattdepot/users/oscar@wattdepot.org" + "\n"
        + "Location: http://server.wattdepot.org:8182/wattdepot/users/oscar@wattdepot.org" + "\n"
        + "Coordinates: 0,0,0" + "\n"
        + "Properties: [Property [key=carbonIntensity, value=1744], Property [key=fuelType, "
        + "value=LSFO]]" + "\n" + "Earliest Data: 2009-10-25T00:00:00.000-10:00" + "\n"
        + "Latest Data: 2009-12-31T23:45:00.000-10:00" + "\n" + "Total Data Points: 6528" + "\n"
        , theSummary);

  }

}
